package com.lx.sync.consumer.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lx.sync.consumer.entity.SyncStateEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 同步状态Mapper
 */
@Mapper
public interface SyncStateMapper extends BaseMapper<SyncStateEntity> {

    /**
     * 获取最新的同步状态
     */
    @Select("SELECT * FROM sync_state WHERE idx_name = #{idxName} ORDER BY start_time DESC LIMIT 1")
    SyncStateEntity getLatestSyncState(String idxName);
}
